﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 多对多
{
    internal class StudentConfig : IEntityTypeConfiguration<Student>
    {
        public void Configure(EntityTypeBuilder<Student> builder)
        {
            builder.ToTable("T_Students");
            //builder.HasMany<Teacher>(a => a.Teachers).WithMany(a => a.Students).UsingEntity(j => j.ToTable("T_Students_Teachers"));
            builder.HasMany<Teacher>(a => a.Teachers).WithMany(a => a.Students).UsingEntity<StudentTeacher>("T_Students_Teachers");
        }
    }
}
